"use strict";
const common_vendor = require("../../../../../../../common/vendor.js");
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "index",
  setup(__props) {
    const diseaseschart = common_vendor.ref(null);
    const diseasestype = common_vendor.ref({
      QD: 1,
      ZCGZ: 1
    });
    common_vendor.onMounted(() => {
      if (diseaseschart.value) {
        const myChart = common_vendor.init(diseaseschart.value);
        window.addEventListener("resize", () => {
          myChart.resize();
        });
        const option = {
          grid: {
            left: "10%",
            // 调整左边距，确保图表不会和图例重叠
            right: "10%",
            // 调整右边距
            top: "10%",
            // 调整上边距
            bottom: "10%"
            // 调整下边距
          },
          tooltip: {
            trigger: "item",
            formatter: "{b}: {c}    {d}%"
            // 修改为仅显示框中内容
          },
          legend: {
            orient: "vertical",
            left: "65%",
            // 调整图例的位置，使其在图的右边
            top: "center",
            // 图例垂直居中
            formatter(name) {
              const data = option.series[0].data;
              const item = data.find((item2) => item2.name === name);
              if (item) {
                const total = data.reduce((sum, item2) => sum + item2.value, 0);
                const percent = (item.value / total * 100).toFixed(2);
                return `${name}: ${item.value} ${percent}%`;
              }
              return name;
            }
          },
          series: [
            {
              type: "pie",
              data: [
                {
                  value: diseasestype.value.QD,
                  name: "轻度",
                  itemStyle: {
                    color: new common_vendor.LinearGradient(0, 0, 1, 1, [
                      { offset: 0, color: "#D95040" },
                      { offset: 1, color: "#FF7F50" }
                    ])
                  }
                },
                {
                  value: diseasestype.value.ZCGZ,
                  name: "正常高值",
                  itemStyle: {
                    color: new common_vendor.LinearGradient(0, 0, 1, 1, [
                      { offset: 0, color: "#EE752F" },
                      { offset: 1, color: "#FFA07A" }
                    ])
                  }
                }
              ],
              radius: ["65%", "80%"],
              label: {
                show: false
                // 隐藏标签
              }
            }
          ]
        };
        myChart.setOption(option);
      }
    });
    return (_ctx, _cache) => {
      return {};
    };
  }
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-86d7dac4"]]);
wx.createComponent(Component);
